﻿using System;
using UnityEngine;

namespace RootMotion.FinalIK
{
	// Token: 0x02000140 RID: 320
	[Serializable]
	public class Constraints
	{
		// Token: 0x060004D0 RID: 1232 RVA: 0x00015233 File Offset: 0x00013633
		public bool IsValid()
		{
			return this.transform != null;
		}

		// Token: 0x060004D1 RID: 1233 RVA: 0x00015241 File Offset: 0x00013641
		public void Initiate(Transform transform)
		{
			this.transform = transform;
			this.position = transform.position;
			this.rotation = transform.eulerAngles;
		}

		// Token: 0x060004D2 RID: 1234 RVA: 0x00015264 File Offset: 0x00013664
		public void Update()
		{
			if (!this.IsValid())
			{
				return;
			}
			this.transform.position += this.positionOffset;
			if (this.positionWeight > 0f)
			{
				this.transform.position = Vector3.Lerp(this.transform.position, this.position, this.positionWeight);
			}
			this.transform.rotation = Quaternion.Euler(this.rotationOffset) * this.transform.rotation;
			if (this.rotationWeight > 0f)
			{
				this.transform.rotation = Quaternion.Slerp(this.transform.rotation, Quaternion.Euler(this.rotation), this.rotationWeight);
			}
		}

		// Token: 0x04000212 RID: 530
		public Transform transform;

		// Token: 0x04000213 RID: 531
		public Vector3 positionOffset;

		// Token: 0x04000214 RID: 532
		public Vector3 position;

		// Token: 0x04000215 RID: 533
		[Range(0f, 1f)]
		public float positionWeight;

		// Token: 0x04000216 RID: 534
		public Vector3 rotationOffset;

		// Token: 0x04000217 RID: 535
		public Vector3 rotation;

		// Token: 0x04000218 RID: 536
		[Range(0f, 1f)]
		public float rotationWeight;
	}
}
